<?php

function fnMstInformasi() {
    $results = mysql_query("SELECT	
                                id,
                                keterangan,
                                nama_file
                            FROM
                                mst_informasi");
    return $results;
}

function fnAllInfo() {
    $results = mysql_query("select c.* from (
                                select @rownum:=@rownum+1 as rownum, a.*
                                from mst_informasi a, (select @rownum:=0) b
                            ) c ");
    return $results;
}

function fnInfoById($id) {
    $results = mysql_query("SELECT	
                                id,
                                keterangan,
                                nama_file
                            FROM
                                mst_informasi
                            WHERE id = ".$id);
    return $results;
}

function fnAllInfoByRange($startNum, $endNum) {
    $results = mysql_query("select c.* from (
                                select @rownum:=@rownum+1 as rownum, a.*
                                from mst_informasi a, (select @rownum:=0) b
                            ) c where 1=1
                            and c.rownum between ".$startNum." and ".$endNum);
    return $results;
}

function fnInsertInformasi($Keterangan, $namaFile) {
  $result = mysql_query("INSERT INTO mst_informasi 
                          	(Keterangan, nama_file)
                         VALUES
                          	('$Keterangan','$namaFile')
                         ");
  return $result;
}

function fnUpdateInformasi($Id,$Keterangan,$namaFile) {
  $result = mysql_query("UPDATE mst_informasi SET 
                              	Keterangan = '$Keterangan',
                                nama_file = '$namaFile'
                         WHERE Id = $Id");
  return $result;
}

function fnDeleteInformasi($Id) {
  $result = mysql_query("DELETE FROM mst_informasi 
                         WHERE Id = $Id");
  return $result;
}

?>
